{
  "openapi": "3.0.0",
  "info": {
    "title": "Payment API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "http://localhost:8080"
    }
  ],
  "paths": {
    "/new_payment": {
      "post": {
        "summary": "Process a new payment",
        "description": "Process a new payment using the specified payment method",
        "operationId": "processPayment",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "transaction_amount": {
                    "type": "number",
                    "description": "The amount to be paid"
                  },
                  "description": {
                    "type": "string",
                    "description": "A brief description of the payment"
                  },
                  "payment_method_id": {
                    "type": "string",
                    "description": "The payment method to be used"
                  },
                  "payer": {
                    "$ref": "#/components/schemas/Payer"
                  }
                },
                "required": [
                  "transaction_amount",
                  "description",
                  "payment_method_id",
                  "payer"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Payment processed successfully"
          },
          "400": {
            "description": "Invalid request"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Payer": {
        "type": "object",
        "description": "Information about the payer, including their name, email, and identification number",
        "properties": {
          "name": {
            "type": "string",
            "description": "The payer's name"
          },
          "email": {
            "type": "string",
            "description": "The payer's email address"
          },
          "identification": {
            "type": "object",
            "description": "The payer's identification number",
            "properties": {
              "type": {
                "type": "string",
                "description": "The type of identification document (e.g., CPF, CNPJ)"
              },
              "number": {
                "type": "string",
                "description": "The identification number"
              }
            },
            "required": [
              "type",
              "number"
            ]
          }
        },
        "required": [
          "name",
          "email",
          "identification"
        ]
      }
    }
  }
}
